#!/usr/bin/env zx
const currentDir = __dirname

// await $`docker login --username=carol199064 registry.cn-hangzhou.aliyuncs.com --password=moto9171`
cd(`../xdclass-common`)
await $`mvn install`

const versionInput = await question("what is the version? ")
pushGatewayService(versionInput)

cd(currentDir)

async function pushGatewayService(version) {
    // 构建网关
    cd('../xdclass-gateway')
    await $`mvn install -Dmaven.test.skip=true dockerfile:build`
    await $`docker tag xdclass-cloud/xdclass-gateway:latest registry.cn-shenzhen.aliyuncs.com/1024-cloud/api-gateway:${version}`
    await $`docker push registry.cn-shenzhen.aliyuncs.com/1024-cloud/api-gateway:${version}`
    console.log(chalk.blue("网关构建推送成功"))
}